package com.example.administrator.xiaoxiang.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.example.administrator.xiaoxiang.R;
import com.example.administrator.xiaoxiang.url.URLResource;

//账户管理  联系客服  常见问题 设置
public class SettingActivity extends AppCompatActivity implements View.OnClickListener {


    private ImageView imagebtn;
    private WebView wb2,wb3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        String iddata = intent.getStringExtra("id");

        Log.d("1620", "" + iddata);
        if (iddata.equals("ic8")) {
            setContentView(R.layout.activity_setting4);
            imagebtn = (ImageView) findViewById(R.id.setting_black_img_btn);
            imagebtn.setOnClickListener(this);
        }
        if (iddata.equals("ic9")) {
            setContentView(R.layout.activity_setting3);
            wb3= (WebView) findViewById(R.id.webview_setting3);
            wb3.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);//设置js可以直接打开窗口，如window.open()，默认为false
            wb3.getSettings().setJavaScriptEnabled(true);//是否允许执行js，默认为false。设置true时，会提醒可能造成XSS漏洞
            wb3.getSettings().setSupportZoom(true);//是否可以缩放，默认true
            wb3.getSettings().setBuiltInZoomControls(true);//是否显示缩放按钮，默认false
            wb3.getSettings().setUseWideViewPort(true);//设置此属性，可任意比例缩放。大视图模式
            wb3.getSettings().setLoadWithOverviewMode(true);//和setUseWideViewPort(true)一起解决网页自适应问题
            wb3.getSettings().setAppCacheEnabled(true);//是否使用缓存
            wb3.getSettings().setDomStorageEnabled(true);//DOM Storage
            wb3.loadUrl(URLResource.kefu);

        }
        if (iddata.equals("ic10")) {
            setContentView(R.layout.activity_setting2);
            wb2 = (WebView) findViewById(R.id.webview_setting2);
            wb2.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);//设置js可以直接打开窗口，如window.open()，默认为false
            wb2.getSettings().setJavaScriptEnabled(true);//是否允许执行js，默认为false。设置true时，会提醒可能造成XSS漏洞
            wb2.getSettings().setSupportZoom(true);//是否可以缩放，默认true
            wb2.getSettings().setBuiltInZoomControls(true);//是否显示缩放按钮，默认false
            wb2.getSettings().setUseWideViewPort(true);//设置此属性，可任意比例缩放。大视图模式
            wb2.getSettings().setLoadWithOverviewMode(true);//和setUseWideViewPort(true)一起解决网页自适应问题
            wb2.getSettings().setAppCacheEnabled(true);//是否使用缓存
            wb2.getSettings().setDomStorageEnabled(true);//DOM Storage
            wb2.loadUrl(URLResource.changjianwenti);

        }
        if (iddata.equals("ic11")) {
            setContentView(R.layout.activity_setting);
            Button button = (Button) findViewById(R.id.btn_setting5);
            button.setOnClickListener(this);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.setting_black_img_btn:
                finish();
                break;
            case R.id.btn_setting_1:
                finish();
                break;
            case R.id.btn_setting5:
                Toast.makeText(this, "退出成功", Toast.LENGTH_SHORT).show();
                MainActivity.isLongin = false;
                break;
        }
    }
}
